﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.Master" AutoEventWireup="true" CodeBehind="QuanLyDanhMuc.aspx.cs" Inherits="EC21_EDiamond.Admin.QuanLyDanhMuc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <table style="width: 100%;">
        <tr>
            <td colspan="2" class="text-center" style="font-size: xx-large; color: #000000"><strong>QUẢN LÝ DANH MỤC</strong></td>
        </tr>
        <tr>
            <td style="width: 405px; text-align: right;" class="text-right">Tên Danh Mục:</td>
            <td class="text-left">
                <asp:TextBox ID="txtTenDanhMuc" runat="server" Width="170px" placeholder="Tên Danh Mục"></asp:TextBox>
            &nbsp;
                <asp:Button ID="btnThem" runat="server" CausesValidation="False" OnClick="btnThem_Click" Text="Thêm Danh Mục" />
            </td>
        </tr>
        <tr>
            <td style="width: 385px; height: 19px;" class="text-right">
            </td>
            <td style="height: 19px" class="text-left">
                <asp:Label ID="lblThongBao" runat="server" style="color: #FF0000"></asp:Label>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtTenDanhMuc" ErrorMessage="Không để trống!" style="color: #FF0000"></asp:RequiredFieldValidator>
                </td>
        </tr>
        <tr>
            <td style="height: 19px;" class="text-right" colspan="2">
                &nbsp;</td>
        </tr>
        <tr>
            <td style="height: 48px; text-align: center;" class="text-right" colspan="2">
                <asp:GridView ID="grwDanhMuc" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="MaDM" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Horizontal" Width="848px">
                    <Columns>
                        <asp:BoundField DataField="MaDM" HeaderText="MÃ DANH MỤC" InsertVisible="False" ReadOnly="True" SortExpression="MaDM" />
                        <asp:BoundField DataField="TenDM" HeaderText="TÊN DANH MỤC" SortExpression="TenDM" />
                        <asp:CommandField ShowEditButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
                    <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
                    <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F7F7F7" />
                    <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
                    <SortedDescendingCellStyle BackColor="#E5E5E5" />
                    <SortedDescendingHeaderStyle BackColor="#242121" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:aspnetdbConnectionString %>" DeleteCommand="DELETE FROM [DanhMuc] WHERE [MaDM] = @original_MaDM AND (([TenDM] = @original_TenDM) OR ([TenDM] IS NULL AND @original_TenDM IS NULL))" InsertCommand="INSERT INTO [DanhMuc] ([TenDM]) VALUES (@TenDM)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [DanhMuc]" UpdateCommand="UPDATE [DanhMuc] SET [TenDM] = @TenDM WHERE [MaDM] = @original_MaDM AND (([TenDM] = @original_TenDM) OR ([TenDM] IS NULL AND @original_TenDM IS NULL))">
                    <DeleteParameters>
                        <asp:Parameter Name="original_MaDM" Type="Int32" />
                        <asp:Parameter Name="original_TenDM" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="TenDM" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="TenDM" Type="String" />
                        <asp:Parameter Name="original_MaDM" Type="Int32" />
                        <asp:Parameter Name="original_TenDM" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>
</asp:Content>
